//
//  MainViewController.m
//  SYTestApplication
//
//  Created by dllo on 16/8/26.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MainViewController.h"

#import "TodayViewController.h"
#import "NewsViewController.h"
#import "BrandsViewController.h"
#import "VideosViewController.h"
#import "MoreViewController.h"

#import "BaseNavigationController.h"
@interface MainViewController ()

@end

@implementation MainViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        [[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]} forState:UIControlStateNormal];
        self.tabBar.translucent = NO;
        [self createNavigationController];
    }
    return self;
}

- (void)createNavigationController
{
    BaseNavigationController *navToday = [[BaseNavigationController alloc] initWithRootViewController:[TodayViewController new]];
    BaseNavigationController *navNews = [[BaseNavigationController alloc] initWithRootViewController:[NewsViewController new]];
    BaseNavigationController *navBrands = [[BaseNavigationController alloc] initWithRootViewController:[BrandsViewController new]];
    BaseNavigationController *navVideos = [[BaseNavigationController alloc] initWithRootViewController:[VideosViewController new]];
    BaseNavigationController *navMore =  [[BaseNavigationController alloc] initWithRootViewController:[MoreViewController new]];
    
    
    self.tabBar.backgroundColor = [UIColor whiteColor];
    
    navToday.tabBarItem = [[UITabBarItem alloc] initWithTitle:nil image:[UIImage imageNamed:@"TitleTab_0Highlighted"] selectedImage:nil];
    
    navNews.tabBarItem = [[UITabBarItem alloc] initWithTitle:nil image:[UIImage imageNamed:@"TitleTab_1Highlighted"] selectedImage:nil];
    navBrands.tabBarItem = [[UITabBarItem alloc] initWithTitle:nil image:[UIImage imageNamed:@"TitleTab_2Highlighted"] selectedImage:nil];
    navVideos.tabBarItem = [[UITabBarItem alloc] initWithTitle:nil image:[UIImage imageNamed:@"TitleTab_3Highlighted"] selectedImage:nil];
    navMore.tabBarItem = [[UITabBarItem alloc] initWithTitle:nil image:[UIImage imageNamed:@"TitleTab_4Normal"] selectedImage:nil];
    [self setViewControllers:@[navToday,navNews,navBrands,navVideos,navMore]];
}



- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
